package org.client.otdr.resolver;

import org.openems.entity.Entity;
import org.openems.entity.Key;
import org.openems.entity.ListEntity;

import framework.AccessorHelper;
import framework.resolver.UnitResolver;

public class MarkerListResolver implements UnitResolver {

	@Override
	public void resolve(Entity oldEntity, Entity newEntity, AccessorHelper helper) {
		ListEntity olde = (ListEntity)oldEntity;
		ListEntity newe = (ListEntity)newEntity;
		for (Key key : olde.getKeys()) {
			boolean found = false;
			for (Key key2 : newe.getKeys()) {
				if (key.equals(key2)) {
					found = true;
				}
			}
			if (!found) {
				helper.removeListItem(key);
			}
		}
	}

}
